#!/usr/bin/env python
#-------------------------------------------------------------------------------
# Copyright (c) 2008 Andrew Coleman under the MIT License
# See COPYING at the root directory of this project.
#-------------------------------------------------------------------------------
# Standard Modules
#from Crypto.Hash import SHA256
# Project Modules
import conf
import output

def check_auth(user):
    if conf.Settings["Modes"]["ControlMode"] == "Single User":
        if user == conf.Settings["Control"]["Settings"]["Single User"]["User"]:
            return True
        else:
            return False
    elif conf.Settings["Modes"]["ControlMode"] == "Registration":
        if user in conf.Settings["Control"]["Settings"]["Registration"]["Users"]:
            return True
        else:
            return False
    elif conf.Settings["Modes"]["ControlMode"] == "Open":
        return True
    elif conf.Settings["Modes"]["ControlMode"] == "Closed":
        return False

#def _make_hash(plaintext):
    #new_hash = SHA256.new(conf.settings["users_settings"]["base_rand_string"])
    #new_hash.update(plaintext)
    #return new_hash.hexdigest()